package game.players.user;

import game.ball.Possessed;
import game.players.SoccerPlayer;
import game.players.states.WithBall;

import com.uqbar.vainilla.DeltaState;
import com.uqbar.vainilla.appearances.Sprite;
import com.uqbar.vainilla.events.constants.Key;

public class CornerKickerThrowInerUser extends WithBall {

	public CornerKickerThrowInerUser(SoccerPlayer player) {
		super(player);
		this.getPlayer().setAppearance(Sprite.fromImage("/images/goal3_caminando2.png").crop(0, 1, 34, 65).scale(1.5));
		player.getScene().getSoccerBall().setState(new Possessed(player));
		this.setTeammates(this.getPlayer().getScene().getTeammates());
		this.setSoccerBall(this.getPlayer().getScene().getSoccerBall());
	}

	@Override
	public void update(DeltaState deltaState) {
		if(deltaState.isKeyPressed(Key.X)){
			this.getPlayer().setState(new PassingUserPlayer(this.getPlayer(), this.getClosestMate()));
			this.getPlayer().getScene().setBallOnGame(true);
		}
		
	}

	@Override
	public boolean isRight() {
		return false;
	}

	@Override
	public void loseTheBall() {
		// no puede perder la pelota si esta sacando el corner		
	}

}
